﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DevOnServer
{
    public enum ObjType
    {
        Object,
        Player,
        Drop,
        Monster,
        Npc,
        Ctrl
    }

    public abstract class CWorldObject : CTimed
    {
        public CWorldObject(int id, CWorld world)
        {
            ID = id;
            World = world;
        }

        public int ID { get; private set; }

        public CWorld World;

        public CWorldField Field;

        public CRespawner Respawner;

        public CVec3Df Position;

        public short Rotation;

        public short Size = 100;

        public virtual ObjType Type
        {
            get
            {
                return ObjType.Object;
            }
        }

        public void onChangePosition()
        {
            World.updateField(this);
        }

        public virtual void onWorldRemove()
        {
            if (Field != null)
            {
                Field.removeObject(this);
                Field = null;
            }

            World.noTarget(this);
        }
    }
}